<?php
/**
 * Theme search bar across the header
 * Only show it on certain pages
 *
 * @author AppThemes
 * @package ClassiPress
 *
 */
?>

<?php if (is_home() || is_search() || is_404() || is_tax('ad_cat') || is_singular('ad_listing')) : ?>

	<div id="search-bar">

		<div class="searchblock_out">

			<div class="searchblock">

				<form action="<?php bloginfo('url'); ?>" method="get" id="searchform" class="form_search">

					<div class="searchfield">

						<input name="s" type="text" id="s" tabindex="1" class="editbox_search" style="width:<?php echo get_option('cp_search_field_width'); ?>" <?php if(get_search_query()) { echo 'value="'.trim(strip_tags(esc_attr(get_search_query()))).'"'; } else { ?> value="<?php _e('What are you looking for?','appthemes'); ?>" onfocus="if (this.value == '<?php _e('What are you looking for?','appthemes'); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('What are you looking for?','appthemes'); ?>';}" <?php } ?> />

					</div>

					<div class="searchbutcat">

						<button class="btn-topsearch" type="submit" tabindex="3" title="Search Ads" id="go" value="search" name="sa"><?php _e('Search Ads','appthemes'); ?></button>

						<?php wp_dropdown_categories('show_option_all='.__('All Categories', 'appthemes').'&hierarchical='.get_option('cp_cat_hierarchy').'&hide_empty='.get_option('cp_cat_hide_empty').'&depth='.get_option('cp_search_depth').'&show_count='.get_option('cp_cat_child_count').'&orderby='.get_option('cp_cat_orderby').'&title_li=&use_desc_for_title=1&tab_index=2&class=searchbar&taxonomy=ad_cat'); ?>

					</div>

				</form>

			</div> <!-- /searchblock -->

		</div> <!-- /searchblock_out -->

	</div> <!-- /search-bar -->

<?php endif; ?>